perform calculations